'\" te
.\" Copyright (c) 2001, Sun Microsystems, Inc.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH ACLSORT 3SEC "Dec 10, 2001"
.SH NAME
aclsort \- sort an ACL
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsec\fR [ \fIlibrary\fR ... ]
#include <sys/acl.h>

\fBint\fR \fBaclsort\fR(\fBint\fR \fInentries\fR, \fBint\fR \fIcalclass\fR, \fBaclent_t *\fR\fIaclbufp\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fIaclbufp\fR argument points to a buffer containing \fBACL\fR entries. The
\fInentries\fR argument specifies the number of \fBACL\fR entries in the
buffer. The \fIcalclass\fR argument, if non-zero, indicates that the
\fBCLASS_OBJ\fR (\fBACL\fR mask) permissions should be recalculated. The union
of the permission bits associated with all \fBACL\fR entries in the buffer
other than \fBCLASS_OBJ\fR, \fBOTHER_OBJ\fR, and \fBUSER_OBJ\fR is calculated.
The result is copied to the permission bits associated with the \fBCLASS_OBJ\fR
entry.
.sp
.LP
The \fBaclsort()\fR function sorts the contents of the \fBACL\fR buffer as
follows:
.RS +4
.TP
.ie t \(bu
.el o
Entries will be in the order \fBUSER_OBJ\fR, \fBUSER\fR, \fBGROUP_OBJ\fR,
\fBGROUP\fR, \fBCLASS_OBJ\fR (\fBACL\fR mask), \fBOTHER_OBJ\fR,
\fBDEF_USER_OBJ\fR, \fBDEF_USER\fR, \fBDEF_GROUP_OBJ\fR, \fBDEF_GROUP\fR,
\fBDEF_CLASS_OBJ\fR (default \fBACL\fR mask), and \fBDEF_OTHER_OBJ\fR.
.RE
.RS +4
.TP
.ie t \(bu
.el o
Entries of type \fBUSER\fR, \fBGROUP\fR, \fBDEF_USER\fR, and \fBDEF_GROUP\fR
will be sorted in increasing order by \fBID\fR.
.RE
.sp
.LP
The \fBaclsort()\fR function will succeed if all of the following are true:
.RS +4
.TP
.ie t \(bu
.el o
There is exactly one entry each of type \fBUSER_OBJ\fR, \fBGROUP_OBJ\fR,
\fBCLASS_OBJ\fR (\fBACL\fR mask), and \fBOTHER_OBJ\fR.
.RE
.RS +4
.TP
.ie t \(bu
.el o
There is exactly one entry each of type \fBDEF_USER_OBJ\fR,
\fBDEF_GROUP_OBJ\fR, \fBDEF_CLASS_OBJ\fR (default \fBACL\fR mask), and
\fBDEF_OTHER_OBJ\fR if there are any default entries.
.RE
.RS +4
.TP
.ie t \(bu
.el o
Entries of type \fBUSER\fR, \fBGROUP\fR, \fBDEF_USER\fR, or \fBDEF_GROUP\fR may
not contain duplicate entries. A duplicate entry is one of the same type
containing the same numeric \fBID\fR.
.RE
.SH RETURN VALUES
.sp
.LP
Upon successful completion, the function returns \fB0\fR. Otherwise, it returns
\fB\(mi1\fR\&.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Evolving
_
MT-Level	Unsafe
.TE

.SH SEE ALSO
.sp
.LP
.BR acl (2),
.BR aclcheck (3SEC),
.BR attributes (7)
